/*
 * @Description:
 * @Author: wangyigang
 * @Date: 2022-08-12 14:34:25
 * @LastEditTime: 2022-08-12 16:06:48
 * @LastEditors: wangyigang
 */

import {
  AppstoreOutlined,
  MailOutlined,
  SettingOutlined,
} from "@ant-design/icons";
import { Menu } from "antd";
import React, { useState } from "react";
import { useRouter } from 'next/router'

const items = [
  {
    label: "Navigation One",
    key: "mail",
    icon: <MailOutlined />,
  },
  {
    label: "Navigation Two",
    key: "app",
    icon: <AppstoreOutlined />,
    disabled: true,
  },
  {
    label: "Navigation Three - Submenu",
    key: "SubMenu",
    icon: <SettingOutlined />,
    children: [
      {
        type: "group",
        label: "Item 1",
        children: [
          {
            label: "Option 11111111",
            key: "setting:1",
          },
          {
            label: "Option 2",
            key: "setting:2",
          },
        ],
      },
      {
        type: "group",
        label: "Item 2",
        children: [
          {
            label: "Option 3",
            key: "setting:3",
          },
          {
            label: "Option 4",
            key: "setting:4",
          },
        ],
      },
    ],
  },
  {
    label: (
      <a href='https://ant.design' target='_blank' rel='noopener noreferrer'>
        Navigation Four - Link
      </a>
    ),
    key: "alipay",
  },
];

const Post = () => {
  const [current, setCurrent] = useState("mail");
  const router = useRouter()
  const onClick = (e) => {
   if(e.key=='mail'){
        router.push('/about')
   }else if(e.key=='setting:1'){
        router.push('/')
   }else if(e.key=='setting:2'){
        router.push('/testApi/Z-000071')
   }
    console.log("click ", e);
    setCurrent(e.key);
  };

  return (
    <Menu
      onClick={onClick}
      selectedKeys={[current]}
      mode='horizontal'
      items={items}
    />
  );
  //    return (
  //     <div>

  //             导航栏
  //     </div>
  //    )
};

export default Post;
